<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>学院-博客园</title>
    <link rel="stylesheet" href="./xlr-css/reset.css">
    <link rel="stylesheet" href="./xlr-css/plan.css">
    <link rel="shortcut icon" href="./img/blog-sy/favicon.ico" type="image/x-icon">
    <link rel="stylesheet" href="./xlr-css/example.css">
    <link rel="stylesheet" href="./xlr-css/sweet-alert.css">
    <script src="./lib/jquery/jquery.min.js"></script>
    <script src="./xlr-js/sweet-alert.js"></script>
    <script src="./xlr-js/sweet-alert.min.js"></script>
    <style>
        .first {
            color: #9eca9f;
        }
    </style>
</head>

<body>
    <!-- 顶部导航 -->
    <div class="nav-top">
        <ul>
            <li><img src="./xlr-img/logo.png" alt=""></li>
            <li><a href="/">首页</a></li>
            <li><a href="/going" class="first">学习计划</a></li>
            <li><a href="/class">班级</a></li>
            <li><a href="/dynamic">学习动态</a></li>
        </ul>

    </div>
    <div class="content">
        <ul class="nav">
            <li>进行中</li>
            <li class="over">已创建</li>
        </ul>
        <span class="addition" id="save">+</span>
        <div class="content-log"><img src="./xlr-img/yezi.png" alt=""></div>
    </div>
    <!-- 创建学习目标的输入框 -->
    <div class="add">
        <form action="" method="get">
            <input type="text" placeholder="创建学习目标" id="create" name="content">
        </form>

    </div>
    <script>
        // 获取输入框中的内容发送到后台
        $('#save').on('click', function () {
            let formData = $('form').serialize();
            console.log(formData);
            $.ajax({
                type: 'get',
                url: '/writeAdd',
                data: formData,
                success: function (result) {
                    if (result.code == '1101') {
                        swal({
                            title: "已保存",
                            text: "好好学习，天天向上",
                            imageUrl: './xlr-img/thumbs-up.jpg'
                        })
                    }
                }
            })
        })
        // 跳转到展示页面
        $('.over').on('click', function () {
            location.href = '/show'
        })
    </script>
</body>

</html>